import vue from '@vitejs/plugin-vue';
import {defineConfig} from 'vite';
import {resolve} from 'path';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  server: {
    host: '0.0.0.0',
    port: 9999,
    open: true, //启动项目时，在浏览器中自动打开程序
    hmr: true, // 禁止或者开启hmr连接
    // 传递给 chockidar 的文件系统监视器选项
    watch: {
      ignored: ['!**/node_modules/your-package-name/**'],
    },
    https: false, // 是否开启 https,
    proxy: {
      '/api': {
        target: '',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ''),
      },
    },
  },
  resolve: {
    alias: {
      '@': resolve(__dirname, 'src')
    }
  },
  css: {
      preprocessorOptions: {
        scss: {
          additionalData: '@import "./src/assets/css/global.scss";'
        }
      }
  },
  base: './'
})
